#include "types.h"
#include "stat.h"
#include "user.h"

int main() {


	setticket(1);
  	int t[3] = {10, 20, 30};
  	for(int i=0;i<3;i++){
    		int pid = fork();
    		if(pid == 0){
      			setticket(t[i]);
      			volatile int s=0;
      			for(long k=0;k<80000000L;k++) s += k;
      			printf(1, "child done, tickets=%d, s=%d\n", t[i], s);
      			exit();
    			}
  		}
  	for(int i=0;i<3;i++) wait();
  	printf(1, "lottery test finished\n");
  	exit();
}

